﻿var Colorful = function () {
    this.about();
}
Colorful.prototype.about = function () {
    var $lastActive = null;
    function switchBox() {
        var $this = $(this);
        if ($lastActive && !$lastActive[0].$cont) {
            $lastActive[0].$cont = $lastActive.find('>div');
        }
        if (!this.$cont)
            this.$cont = $this.find('>div');
        var isActive = $this.hasClass('active');
        if (isActive) {
            $this.removeClass('active');
            $lastActive[0].$cont.hide();
        } else {
            if ($lastActive !== null) {
                $lastActive.removeClass('active');
                $lastActive[0].$cont.hide();
            }
            $this.addClass('active');
            $lastActive = $this;
            this.$cont.show();
        }  
    }
    $('.about>div').on('click', function () {
        switchBox.call(this);
    }).on('blur', function () {
        switchBox.call(this);
    });
}
new Colorful();